#ifndef VISITOR_H_
#define VISITOR_H_

class BackupDoc;
class RestoreDoc;

/*
 * Visitor encapsulate related operations
 * of different classes into one class.
 * 
 * The concrete operation for concrete class
 * take the pointer of concrete class.
 * So it could access its internal status
 * and operation different class differently.
 *
 * To add a new operation for concrete class,
 * just add a new concrete Visitor.
 * But not to add interface in parent class.
 *
 * MAYBE: could store the pointer of concrete class
 *        and do the operation later.
 */
class Visitor
{
public:
	virtual ~Visitor(void);

protected:
	Visitor(void);

public:
	virtual void visitBackupDoc(BackupDoc*) = 0;
	virtual void visitRestoreDoc(RestoreDoc*) = 0;
};

/*
 * This visitor is used to show the document.
 */
class ShowVisitor : public Visitor
{
public:
	ShowVisitor(void);
	virtual ~ShowVisitor(void);

public:
	void visitBackupDoc(BackupDoc*);
	void visitRestoreDoc(RestoreDoc*);
};

/*
 * This visitor is used to do some operations.
 */
class OperationVisitor : public Visitor
{
public:
	OperationVisitor(void);
	virtual ~OperationVisitor(void);

public:
	void visitBackupDoc(BackupDoc*);
	void visitRestoreDoc(RestoreDoc*);
};

#endif // VISITOR_H_
